<?php

namespace IMooc;

class Proxy implements IUserProxy {

    function getUsername($id)
    {
        $db = Factory::getDatabase('slave');
        $db->query('select name from user where id = ' . $id);
    }

    function setUsername($id, $name)
    {
        $db = Factory::getDatabase('master');
        $db->query("update user set name = '{$name}' where id =" . $id);
    }

}
